<include file="Admin:header" />
<style>
html{_overflow-y:scroll}
.swfupload {position: absolute;z-index: 1;}
.mainnav_title {display:none;}
</style>
<link href="./Public/Js/swfupload/swfupload.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./Public/Js/swfupload/swfupload.js"></script>
<script type="text/javascript" src="./Public/Js/swfupload/swfupload.queue.js"></script>
<script type="text/javascript" src="./Public/Js/swfupload/fileprogress.js"></script>
<script type="text/javascript" src="./Public/Js/swfupload/handlers.js"></script>
<script type="text/javascript">

		var file_limit = {$file_limit};
		var swfu;
 		function swfu_init() {
			var settings = {
				flash_url : "./Public/Js/swfupload/swfupload.swf?"+Math.random(),
				flash9_url : "./Public/Js/swfupload/swfupload_fp9.swf",
				upload_url: "{:U('Attachment/upload')}&&mo_import=<?php echo $_GET['mo_import'];?>&mo_model=<?php echo $_GET['mo_model'];?>&t="+$('#template').val(),
				file_post_name : "filedata",
				post_params: {"PHPSESSID" : "<?php echo  $sessid;?>", "isadmin" : "<?php echo $isadmin;?>","userid":"<?php echo $userid?>","swf_auth_key": "<?php echo $swf_auth_key;?>","isthumb" : "<?php echo $isthumb;?>","moduleid" : "<?php echo $moduleid?>","jsessionid":"6cec0edc1e3f35004e618bfed3fcc0af","tt":$('#tt').val()},
				file_size_limit : "<?php echo $file_size;?> MB",
				file_types : "<?php echo $file_types;?>",
				file_types_description : "All Files",
				file_upload_limit : "<?php echo $file_limit;?>",
				file_queue_limit : 0,
				custom_settings : {
					progressTarget : "fsUploadProgress",
					cancelButtonId : "btnCancel",
					tdFilesQueued : document.getElementById("tdFilesQueued"),
					tdFilesUploaded : document.getElementById("tdFilesUploaded"),
					tdErrors : document.getElementById("tdErrors")
				},
				debug: false,
				button_image_url : "",
				button_placeholder_id: "spanButtonPlaceHolder",
				button_width: 75,
				button_height: 29,
				button_text : '',
				button_text_style : '',
				button_text_top_padding: 0,
				button_text_left_padding: 0,
				button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
				button_cursor: SWFUpload.CURSOR.HAND,
				// The event handler functions are defined in handlers.js
				swfupload_preload_handler : preLoad,
				swfupload_load_failed_handler : loadFailed,
				file_queued_handler : fileQueued,
				file_queue_error_handler : fileQueueError,
				upload_start_handler : uploadStart,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete

			};
			swfu = new SWFUpload(settings);
	     };

$.ajaxSetup ({ cache: false });
function ajaxload(typeid,page,inputid)
{
    var data = '';
    var url =  "{:U('Attachment/filelist')}&typeid="+typeid+"&p="+page+"&inputid="+inputid;
    $.ajax({
         type: "POST",
         url: url,
         data: data,
         success: function(msg){
			$('#'+inputid).html(msg);
			for(var i=0;i<ids.length;i++){
				$('#on_'+ids[i]).addClass("on");
			}
         }
    });
}
</script>
<div id="content">
<div id="tabs">
	<div class="title"><ul><li class="on">{:L('upload_file')}</li>
	</ul></div>

	<div class="content_1">
		<div class="tabbox" style="display:block;">
				<div id="divMovieContainer">
					<div class="selectbut"><span id="spanButtonPlaceHolder"></span></div>
					<input type="button" value="{:L('start_upload')}" id="uploadbut" onclick="swfu.startUpload();"/>
<span id="t">
邮件标题:<input type="text" name="tt" id="tt" size="60" /><br />

		邮件模版:<select id="template" name="template" >
		<option value=''>请选择</option>
		<volist name="templates" id="r">
		<option value="{$r.filename}">{$r.filename}</option>
		</volist>
		</select><button onclick="hidet();">确定</button>
</span>
					<div style="color:#959595;line-height:24px;height:24px;background:url() no-repeat;padding-left:20px;"> {:L('upload_say4')} <font color="red">{$file_types}</font> {:L('upload_say5')}</div><br>
					<div style="color:#454545;clear:both;line-height:24px;height:24px;"> {:L('upload_say1')} <font color="red">{$file_limit}</font> {:L('upload_say2')} <font color="red">{$file_size}</font>	{:L('upload_say3')}</div>
				</div>

				<div id="divStatus">{:L('upload_say6')}<span id="tdFilesQueued">0</span>{:L('upload_say7')}<span id="tdErrors">0</span> {:L('upload_say8')}<span id="tdFilesUploaded">0</span> {:L('upload_say9')}</div>
				<fieldset  id="swfupload-box">
					<legend>{:L('file_list')}</legend>
					<ul id="fsUploadProgress"></ul>

				</fieldset>

		</div>
	</div>
</div>

<div  id="myuploadform" style="display:none;" ></div>
<script>
new Tabs("#tabs",".title ul li",".content_1",".tabbox","on",1);
function addfileurl(obj) {
	var strs = $(obj).val() ?  $(obj).val() : '';

	if(strs){
	
		var datas='<div id="uplist_1"><input type="hidden" id="aids" name="aids"  value="0"  /><input type="text"  id="filedata" name="filedata" value="'+strs+'"  /><input type="text"  id="namedata" name="namedata" value=""  /> &nbsp;<a href="javascript:remove_this(\'uplist_1\');">{:L('remove')}</a> </div>';
		$('#myuploadform').html(datas);
//		$('#thumbnails   a ').removeClass("on");
		$('.img a ').removeClass("on");
	}else{

		$('#myuploadform').html('');
	}
}



function hidet(){
	if($('#template').val()){
		$('#t').hide(1000);
		swfu_init();
	}
}
</script>